package fem2.observer;

import java.io.IOException;

import fem2.Model;
import fem2.enu.StrainType;

public class GidStrainObserver extends GidStructuralObserver {

	public GidStrainObserver(Model m, TimeStepObserver o, String projectDir, String projectName) {
		super(m, o, projectDir, projectName);
	}

	public GidStrainObserver(Model m, TimeStepObserver o, String projectDir, String projectName,
			String fileName) {
		super(m, o, projectDir, projectName, fileName);
	}

	@Override
	public void fireStarted() {
	}

	@Override
	public void fireTimeStepStarted() {
	}

	@Override
	public void fireIterationStarted() {
	}

	@Override
	public void fireIterationFinished() {
	}

	@Override
	public void fireTimeStepFinished() {
		double timeStep = timeStepObserver.getCurrentTimeStep();

		try {
			gidPost.writeMesh(m, timeStep);
			gidPost.writeGaussPointStrainResults(m, timeStep, StrainType.SMALL_STRAIN);
		} catch (IOException e) {
			throw new Error("Write failed: " + e.getMessage());
		}
	}

	@Override
	public void fireFinished() {
	}
}
